'\"macro stdmacro
.\"
.\" Copyright (c) 2014,2018-2020 Red Hat.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.TH PMFIND 1 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmfind\f1 \- find PCP services on the network
.SH SYNOPSIS
\f3pmfind\f1
[\f3\-CqrS?\f1]
[\f3\-m\f1 \f2mechanism\f1]
[\f3\-s\f1 \f2service\f1]
[\f3\-t\f1 \f2timeout\f1]
.SH DESCRIPTION
.B pmfind
searches for instances of the specified PCP service being advertised on the
network and prints a list of URLs corresponding to the services discovered.
It can be used in conjunction with
.BR pmfind_check (1)
to automate the monitoring of remote PCP collector systems.
.SH OPTIONS
The available command line options are:
.TP 5
\f3\-C\f1, \f3\-\-containers\f1
Performs containers discovery as well, for each discovered
.BR pmcd (1)
service.
.TP
\f3\-m\f1 \f2mechanism\f1, \f3\-\-mechanism\f1=\f2mechanism\f1
This option sets the
.I mechanism
that
.B pmfind
uses when performing service discovery.
By default, or if the keyword
.I all
is specified, every available mechanism will be used (iteratively).
See the ``MECHANISMS'' section for a description of each available
discovery mechanism.
.TP
\f3\-q\f1, \f3\-\-quiet\f1
This option suppresses all output on the standard output stream.
.TP
\f3\-r\f1, \f3\-\-resolve\f1
Requests that DNS name resolution be attempted for the addresses of
any discovered services.
The default is to display the network addresses of any discovered services.
.TP
\f3\-s\f1 \f2service\f1, \f3\-\-service\f1=\f2service\f1
By default
.B pmfind
will search for all supported PCP services, however a specific PCP
.I service
to discover can be specified using the
.B \-s
option.
Supported services are
.BR pmcd (1),
and
.BR pmproxy (1).
.TP
\f3\-S\f1, \f3\-\-sources\f1
Reports source identifiers for each discovered
.BR pmcd (1)
service.
These identifiers are unique for each host, and are formed using the
(non-optional) context labels available for every PCP collector.
Because the discovery process will often identify multiple paths to
an individual collector host, this option is an important part of
the process of using
.B pmfind
in conjunction with
.BR pmfind_check (1),
to ensure only one
.BR pmie (1)
and/or
.BR pmlogger (1)
process is started for each discovered collector host.
The source identifiers reported by
.B pmfind
are the same as the source identifiers reported by the
.BR pminfo (1)
and
.BR pmseries (1)
commands.
.TP
\f3\-t\f1 \f2seconds\f1, \f3\-\-timeout\f1=\f2seconds\f1
Sets the maximum amount of time in
.I seconds
that
.B pmfind
will take before interrupting the service discovery.
The
.I time
argument is a floating point number representing the number of seconds
before timing out.
The default is to take as much time as is needed to complete the process.
.TP
\fB\-?\fR, \fB\-\-help\fR
Display usage message and exit.
.SH MECHANISMS
Supported mechanisms for service discovery are:
.TP
.B avahi
Searches for services which are broadcasting using mDNS via
.BR avahi-daemon (8).
An optional suffix \fB",timeout=N"\fP may be added to limit the amount of
time waiting for the avahi-daemon.
.B N
is a floating point number specifying the number of seconds to wait.
The default is 0.5 seconds.
This timeout may also be specified by setting the environment variable
.B AVAHI_DISCOVERY_TIMEOUT
to the desired number of seconds.
If both are specified, then the value specified in the environment variable
takes precedence.
.TP
.B probe=<net-address>/<mask-bits>
Actively probes the given subnet for the requested PCP service(s).
.B <net-address>
is an Inet or IPv6 network address and
.B <mask-bits>
is the number of bits used to define the subnet.
For example, 192.168.1.0/24 defines an 8 bit subnet consisting of the
addresses 192.168.1.0 through 192.168.1.255.
An optional suffix \fB",maxThreads=N"\fP may be added to limit the number of
threads used while probing.
The default is the value of FD_SETSIZE (which is typically 1024) or the
number of addresses in the subnet, whichever is less.
An optional suffix \fB",timeout=N"\fP may be added to limit the amount of
time spent waiting for each connection attempt.
N is a floating point number specifying the number of seconds to wait.
The default is 0.02 seconds (20 milliseconds).
.TP
.B shell
Probes the list of addresses provided by scripts for requested PCP service(s).
Several optional, comma-separated parameters can also be provided.
The \fB"path=DIR"\fP option specifies the directory where commands like
.BR pcp-kube-pods (1)
are located (defaults to
.IR "$PCP_BINADM_DIR/discover/" ).
This setting can be further restricted to an individual command
using the \fBcommand=CMD\fP option, but the default is to use all
available commands from the \fBpath\fP.
The \fB"maxThreads=N"\fP option limits the number of threads used while
probing.
The default is the value of FD_SETSIZE (which is typically 1024) or the
number of addresses returned by the scripts, whichever is less.
The \fB"timeout=N"\fP option may be added to limit the amount of
time spent waiting for each connection attempt.
N is a floating point number specifying the number of seconds to wait.
The default is 0.02 seconds (20 milliseconds).
.SH SIGNALS
.B pmfind
will interrupt the service discovery process when one of the following
signals is received: SIGHUP, SIGPIPE, SIGINT, SIGTERM, SIGXFSZ, SIGXCPU.
.B pmfind
will report any results which were discovered up to point of the interruption.
.SH DIAGNOSTICS
The value of the exit status from the command is zero when services were
successfully located, one if no services were found, and two if an error
occurred.
.PP
In the event of an error a message will be generated on standard error
that is intended to be self-explanatory.
.SH FILES
.TP 5
.I $PCP_BINADM_DIR/discover
default path to address discovery scripts
.SH PCP ENVIRONMENT
Environment variables with the prefix \fBPCP_\fP are used to parameterize
the file and directory names used by PCP.
On each installation, the
file \fI/etc/pcp.conf\fP contains the local values for these variables.
The \fB$PCP_CONF\fP variable may be used to specify an alternative
configuration file, as described in \fBpcp.conf\fP(5).
.SH SEE ALSO
.BR PCPIntro (1),
.BR pmcd (1),
.BR pmfind_check (1),
.BR pmie (1),
.BR pminfo (1),
.BR pmlogger (1),
.BR pmproxy (1),
.BR pmseries (1),
.BR pcp-kube-pods (1),
.BR PMAPI (3),
.BR PMWEBAPI (3),
.BR pmDiscoverServices (3),
.BR pcp.conf (5)
and
.BR pcp.env (5).
